!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ig-ui",[],t):"object"==typeof exports?exports["ig-ui"]=t():e["ig-ui"]=t()}(this,()=>(()=>{"use strict";var e={p:"./dist/"};e.p;const t=(e,t)=>new Promise(n=>{setTimeout(()=>n(t),e)});const n=(e,t)=>{_webview.addEvent(e,t)},o=(e,t,n=!1)=>{if(t instanceof FileList&&!n)return console.info("🔵 Calling webview.postMessageWithAdditionalObjects(): ",e,t),void window.chrome.webview?.postMessageWithAdditionalObjects({name:e,data:null},t);const o=n?JSON.stringify(t):t;console.info("🔵 Calling webview.postMessage(): ",e,o),window.chrome.webview?.postMessage({name:e,data:o})};class r{static load(){for(const e in _page.lang){if(!Object.prototype.hasOwnProperty.call(_page.lang,e))continue;const t=_page.lang[e];queryAll(`[lang-text="${e}"]`,null,!0).forEach(e=>{e.innerText=t}),queryAll(`[lang-title="${e}"]`,null,!0).forEach(e=>{e.title=t}),queryAll(`[lang-html="${e}"]`,null,!0).forEach(e=>{let n=t;for(let t=0;t<e.childElementCount;t++){const o=e.children.item(t);o&&(n=n.replaceAll(`{${t}}`,o.outerHTML))}e.innerHTML=n})}}static loadForEl(e){[e,...queryAll("[lang-text]",e)].forEach(e=>{const t=e.getAttribute("lang-text")||"",n=_page.lang[t]||"";n&&(e.innerText=n)});[e,...queryAll("[lang-title]",e)].forEach(e=>{const t=e.getAttribute("lang-title")||"",n=_page.lang[t]||"";n&&(e.title=n)});[e,...queryAll("[lang-html]",e)].forEach(e=>{const t=e.getAttribute("lang-html")||"",n=_page.lang[t]||"";if(n){let t=n;for(let n=0;n<e.childElementCount;n++){const o=e.children.item(n);o&&(t=t.replaceAll(`{${n}}`,o.outerHTML))}e.innerHTML=t}})}static loadFor(e){const t=query(e);r.loadForEl(t)}}window._webview=new class{eventHandlers={};addEvent(e,t){this.eventHandlers[e]=t}removeEvent(e){delete this.eventHandlers[e]}startListening(){window.chrome.webview?.addEventListener("message",({data:e})=>{const t=e?.Name??"",n=e?.Data??"",o=this.eventHandlers[t],r=void 0!==o;console.info(`🔵 Received event '${t}' (handler=${r}) with data:`,"string"==typeof n?`${n.substring(0,100)}...`:n),r&&o(t,n)})}},_webview.startListening(),window.query=function(e,t=null,n=!1){try{const o=(t??document).querySelector(e);return o||n||console.warn(`🟠 query() returns NULL with selector '${e}'`),o}catch{}return null},window.queryAll=(e,t=null,n=!1)=>{try{const o=t??document,r=Array.from(o.querySelectorAll(e));return 0!==r.length||n||console.info(`🔵 queryAll() returns ZERO elements with selector '${e}'`),r}catch{}return[]},window.on=n,window.post=o,window.postAsync=async(e,r,i=!1)=>{let l,a=!1;for(n(e,(t,n)=>{t===e&&(a=!0,l=n,_webview.removeEvent(e))}),o(e,r,i);!a;)await t(100);return l},window._page||(window._page={lang:{},theme:"",isWindows10:!1}),_page.loadLanguage=r.load,t(1e3).then(()=>{document.documentElement.style.setProperty("--transitionMs","300ms")});const i=e=>{let t=e.key.toLowerCase();const n=e.ctrlKey||"control"===t?"ctrl":"",o=e.shiftKey||"shift"===t?"shift":"",r=e.altKey||"alt"===t?"alt":"",i={control:"",shift:"",alt:"",arrowleft:"left",arrowright:"right",arrowup:"up",arrowdown:"down",backspace:"back"," ":"space"};void 0!==i[t]&&(t=i[t]);return[n,o,r,t].filter(Boolean).join("+")};window.onkeydown=e=>{const t=i(e);"escape"===t&&document.querySelector("dialog[open]")||t&&o("KEYDOWN",t)},window.onkeyup=e=>{const t=i(e);t&&o("KEYUP",t)};const l=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;post(t.id)};return query("#BtnImageGlassStore").addEventListener("click",l,!1),query("#BtnCheckForUpdate").addEventListener("click",l,!1),query("#BtnDonate").addEventListener("click",l,!1),query("#BtnClose").addEventListener("click",l,!1),queryAll("[data-license]").forEach(e=>{e.addEventListener("click",()=>post("ViewLicenseFile",e.getAttribute("data-license")),!1)}),query("#BtnCheckForUpdate").focus(),window._page.loadData=(e={})=>{console.info("🔵 Loading data",e),query("#Lbl_CopyrightsYear").innerText=`2010-${(new Date).getUTCFullYear()}`,query("#Img_AppLogo").setAttribute("src",e.AppLogo||""),query("#Img_AppLogo").toggleAttribute("hidden",!1),query("#Img_AppLogo").addEventListener("click",async()=>{const e=!query("#app").style.filter;query("#app").style.filter=e?'url("#effectWaving")':""}),query("#Lbl_AppCode").innerText=e.AppCode||"",query("#Lbl_AppVersion").innerText=e.AppVersion||"",query("#Lbl_AppArchitecture").innerText=e.AppArchitecture||"",query("#Lbl_AppRuntime").innerText=e.AppRuntime||"",query("#Lbl_MagickNET").innerText=e.MagickNET||"",query("#Lbl_WebView2Runtime").innerText=e.WebView2Runtime||""},{}})());
//# sourceMappingURL=FrmAbout.js.map